{include file="header.tpl" jsload="ajax" jsload1="tinymce" jsload3="lightbox" stage="index"}
{include file="tabsmenue-reports.tpl" desktab="active"}

<div id="content-left">
	
	<div id="content-left-in">
		
		<div class="tasks">
			
			{* Display System messages *}
			<div class="infowin_left" style="display:none;" id="systemmsg">
				
				{if $mode == "reportadded"}
				<span class="info_in_green">
					<img src="templates/standard/images/symbols/reports.png" alt="{#report#}" />
					{#reportwasadded#}
				</span>
				{/if}
				
				{if $mode == "reportdeleted"}
				<span class="info_in_green">
					<img src="templates/standard/images/symbols/reports.png" alt="{#report#}" />
					{#reportwasdeleted#}
				</span>
				{/if}
				
				{if $mode == "reporterror"}
				<span class="info_in_red">
					<img src="templates/standard/images/symbols/reports.png" alt="{#report#}" />
					{#reporterror#}
				</span>
				{/if}
				
				{*for async display*}
				<span id = "closed" style = "display:none;" class="info_in_green">
					<img src="templates/standard/images/symbols/projects.png" alt="" />
					{#projectwasclosed#}
				</span>
				
				<span id="deleted" style="display:none;" class="info_in_red">
					<img src="templates/standard/images/symbols/projects.png" alt="" />
					{#projectwasdeleted#}
				</span>
				
			</div>
			
			{literal}
			<script type="text/javascript">
				systemMsg('systemmsg');
			</script>
			{/literal}
			
			<h1>{#reports#}</h1>
			
			{*Generate Report Form*}
			{if $userpermissions.reports.generate}
			<div class="add-main">
				<a id="generate-report-add" class="add" href="javascript:blindtoggle('generate-report-wrap');" onclick="toggleClass(this, 'add-active', 'add');">
					<span>{#generate_report#}</span>
				</a>
			</div>
			<div id="generate-report-wrap" class="addmenue" style="display:none;">
				{include file="generate_report_form.tpl" }
			</div>
			{/if}
			
			{*Reports*}
			{if $reports > 0}
			<div class="reports">
				
				<div class="headline">
					<h2>
						<img src="./templates/standard/images/symbols/tasklist.png" alt="" />
						{#reports#}
					</h2>
				</div>
				
				<div>
					<table class="table-data">
						<thead>
							<tr>
								<th>#</th>
								<th>{#name#}</th>
								<th>{#date#}</th>
								<th>{#options#}</th>
							</tr>
						</thead>
						<tbody>
							{foreach key=key item=report from=$reports}
							<tr>
								<td>{$report.ID}</td>
								<td>{$report.name}</td>
								<td>{$report.date}</td>
								<td>
									<a href="managereports.php?action=view&report_id={$report.ID}" class="report-view" id="view-{$report.ID}">[Ver]</a>
									<a href="managereports.php?action=pdf&report_id={$report.ID}" class="report-topdf" id="pdf-{$report.ID}">[PDF]</a>
									{if $userpermissions.reports.del}
									<a href="managereports.php?action=delete&report_id={$report.ID}" class="report-delete red" id="report-delete-{$report.ID}">[Eliminar]</a>
									{/if}
								</td>
							</tr>
							{/foreach}
						</tbody>
					</table>
				</div>
				
			</div>
			
			<div class="content-spacer"></div>
			
			{/if}
			
		</div>
		
	</div>
	
</div>

{include file="sidebar-a.tpl"}
{include file="footer.tpl"}